package hrm.action.popup;

import hrm.action.Action;
import hrm.action.ActionForward;
import hrm.dto.code.ZipcodeDTO;
import hrm.serviceimple.ZipcodeServiceImple;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class PopZipcodeListAction implements Action {

	@SuppressWarnings("unchecked")
	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		ActionForward actfoward = new ActionForward();
		ZipcodeServiceImple service = ZipcodeServiceImple.getInstance();
		
		String zipcodeId = request.getParameter("zipcodeId");
		String addressId = request.getParameter("addressId");

		String dong = request.getParameter("dong");
		
		request.setAttribute("zipcodeId", zipcodeId);
		request.setAttribute("addressId", addressId);
		
		ZipcodeDTO dto = new ZipcodeDTO();
		dto.setDong(dong);
		
		List <ZipcodeDTO>list = service.getAllZipcode(dto);
		
		request.setAttribute("list", list);
		
		actfoward.setUrl("popZipcodeList");
		
		return actfoward;
	}
}
